// 全局总体工具对象
const old_console_log = console.log;
console.log = function() {
  const getRandomColor = () => {
    return '#' + ('00000' + (Math.random() * 0x1000000 << 0).toString(16)).slice(-6);
  }
  if ( process.env.DEBUG ) {
    const args = [...arguments];
    const message = args.map((item) => {
      return `%c${item}`;
    }).join('');
    let logParams = [message];
    args.forEach(() => {
      logParams.push(`color: ${getRandomColor()};`);
    });
    old_console_log.apply(this, logParams);
  }
}

module.exports = {
  Global: {
    ENV: process.env.ENV,
    API: process.env.API,
    DEBUG: process.env.DEBUG
  }
};
